package com.apes.framework.plugin.mq.log;

import com.apes.framework.util.DateUtil;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;

@Data
@Document(indexName = "logs-mq_consume_" + "#{esIndexName.indexName}", replicas = 0)
public class MQLog {

    @Id
    private String id;

    /**
     * 消息ID
     **/
    private String messageId;

    /**
     * 主题
     **/
    private String topic;

    private String tags;

    /**
     * 消息内容
     **/
    private String body;

    /**
     * 耗时
     **/
    private long time = 0;

    /**
     * 创建时间
     **/
    @Field(type = FieldType.Date)
    private String createdOn = DateUtil.format("yyyy-MM-dd'T'HH:mm:ss.SSS") + "+0800";

    private long createdOnTimeStamp;

    /**
     * 更新时间
     **/
    @Field(type = FieldType.Date)
    private String endedOn;

    private long endOnTimeStamp;

    /**
     * 异常信息
     **/
    private String error;
}
